#ifndef __POD_IO_H
#define __POD_IO_H

#include <string>

#define RX_BUF_LEN		80
#define TX_BUF_LEN		168

enum servo_mode
{
	SERVO_OFF = 0,
	SERVO_HAND,
	SERVO_COLLECT,
	SERVO_FOLLOW,
	SERVO_ZERO,
	SERVO_YAW_SCAN,
	SERVO_TRACK,
	SERVO_PITCH_SCAN
};

enum CAMERA_CMD
{
	BRIGHT_INC = 0X02,
	BRIGHT_DEC = 0X03,

	CONTRAST_INC = 0X04,
	CONTRAST_DEC = 0X05,

	APERTURE_INC = 0X06,
	APERTURE_DEC = 0X07,

	INPECT_INC = 0X08,
	INPECT_DEC = 0X09,

	FOCUS_INC = 0X0A,
	FOCUS_DEC = 0X0B,

	EXPOSURE_INC = 0X10,
	EXPOSURE_DEC = 0X11,

	AUTO_FOCUS_ONCE = 0X12
};

enum OPTICS_VALUE
{
	OPTICS_VALUE_1 = 0X00,
	OPTICS_VALUE_2,
	OPTICS_VALUE_3,
	OPTICS_VALUE_4,
	OPTICS_VALUE_5,
	OPTICS_VALUE_6,
	OPTICS_VALUE_7
};

struct POD_STATE
{
	char servo_state;

	float yaw_deg;			
	float pitch_deg;

	float yaw_rate;			
	float pitch_rate;
};

extern int pod_fd;
extern POD_STATE pod_state;
extern double angle ;
extern double angle_rate;

void open_uart(void);
bool open_uart(std::string port);
void pod_init(void);
void pod_receive(void);
bool pod_receive_for_judge();//jpp
void pod_sent_cmd(servo_mode mode,float yaw_rate,float pitch_rate);
void pod_control_camera(CAMERA_CMD cmd,OPTICS_VALUE value);
void pod_sent_cmd_static();
void close_uart();

#endif
